Skip to content

[hub] Sync safetensors Dtype union with upstream#2187

Merged
julien-c merged 1 commit into
mainfrom
feat/safetensors-dtypes
May 22, 2026
Merged

[hub] Sync safetensors Dtype union with upstream#2187
julien-c merged 1 commit into
mainfrom
feat/safetensors-dtypes

Conversation

@julien-c
Copy link
Copy Markdown
Member

@julien-c julien-c commented May 22, 2026

Summary

  • Adds the safetensors dtypes that were missing from the TS union in packages/hub/src/lib/parse-safetensors-metadata.ts: C64, F8_E4M3FNUZ, F8_E5M2FNUZ, F8_E8M0, U64, U32.
  • Sourced from the upstream Rust enum at https://github.com/huggingface/safetensors/blob/main/safetensors/src/tensor.rs (pub enum Dtype).
  • Leaves the existing non-upstream entries (FP4, E8M0, UE8) in place — happy to remove them in a follow-up if they were not intentional.

Test plan

  • Dtype is only used as Partial<Record<Dtype, number>> and in narrow if (dtype === ...) checks, so adding variants is non-breaking.
  • CI green.

Note

Low Risk
Low risk type-only change that broadens supported safetensors dtype values; behavior is unchanged aside from allowing additional variants in TypeScript checks.

Overview
Updates the safetensors metadata parser’s Dtype TypeScript union to include additional upstream dtype variants (C64, F8_E4M3FNUZ, F8_E5M2FNUZ, F8_E8M0, U64, U32). This expands what parseSafetensorsMetadata can type-safely represent/aggregate without changing parsing logic.

Reviewed by Cursor Bugbot for commit bf4dcb9. Bugbot is set up for automated code reviews on this repo. Configure here.

Sync the `Dtype` union in parse-safetensors-metadata.ts with the
upstream safetensors Rust enum. Adds: C64, F8_E4M3FNUZ, F8_E5M2FNUZ,
F8_E8M0, U64, U32.
@julien-c julien-c requested a review from coyotte508 as a code owner May 22, 2026 13:16
@julien-c julien-c requested a review from mishig25 May 22, 2026 13:17
@julien-c julien-c merged commit a6c9b08 into main May 22, 2026
7 checks passed
@julien-c julien-c deleted the feat/safetensors-dtypes branch May 22, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants